<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>华胜后台管理</title>
    <link rel="stylesheet" type="text/css" href="css/unified.css">
    <script src="plugins/layui/layui.js"></script>

    <style type="text/css">
        .searchform span{margin-left: 10px}
        .layui-table-view .layui-table td, .layui-table-view .layui-table th{padding: 0}
    </style>
</head>
<body>

    <div class="breadcrumbnav">
        <span class="layui-breadcrumb " lay-separator="·">
          <a ><cite>首页</cite></a>
          <a ><cite>采购报表</cite></a>
          <a ><cite>商品采购明细表汇总表</cite></a>
        </span>
    </div>
    <div class="kit-doc">
        <!-- 标题 -->


        <div class="kit-doc-title">
            <fieldset>
                <legend> <a name="blockquote">统计</a>
                </legend>
            </fieldset>
        </div>
        <!-- 标题 end-->
        
        
        <!-- 概述 -->
            <div class="layui-tab-content notab">
                <div class="layui-tab-item layui-show">
                	<table class="layui-table " lay-filter="table100" id="PStable"></table>
                </div>
              </div>

            <script src="../js/jquery-3.2.1.min.js"></script>
            <script>

            layui.use(['layer', 'form', 'element','table','laydate'], function(){
              var layer = layui.layer
              ,form = layui.form
              ,element = layui.element
              ,table = layui.table
              ,laydate = layui.laydate;
var tableArray = new Array();
				
				PStable(1 ,11 );
				function PStable(curr ,limit ){
					AjaxPostFn('system/repository/in/select?page='+curr+'&pagesize='+limit, "{}", function(jsonData) {
						$.each(jsonData.pageInfo.list, function(i, obj) {
							obj = obj.bizRepositoryIn
							tableArray.push({
//								例子"id":obj.id,
								 "id": "16451553-c505-438c-b514-a1660127eeda",
						          "batchId": 17,
						          "locationId": "0",
						          "theNum": 500,
						          "supplierName": null,
						          "supplierContact": null,
						          "supplierPhone": null,
						          "averagePrice": null,
						          "expireTime": null,
						          "comment": null,
						          "createId": null,
						          "createTime": null,
						          "commodityId": null,
						          "merchantNumber": 123,
						          "commodityNumber": null,
						          "barCode": "654646456456"
								
							});
						})
						
						//展示已知数据
						table.render({
							elem: '#EGtable',
							cols: [
								[ //标题栏
									
									{field: 'id',width: 250,title: 'id'},
									{field: 'entrustNumber',width: 100,title: '委托编号'},
									
								]
							],
							data: tableArray,
							size: 'lg',
							even: true,
							page: true, //是否显示分页
							done: function(){
								 laypage.render({
								    elem: 'layui-table-page1' //注意，这里的 test1 是 ID，不用加 # 号
								    ,count: jsonData.pageInfo.total//数据总数，从服务端得到
								    
								    ,jump: function(obj, first){
									    //obj包含了当前分页的所有参数，比如：
									    console.log(obj.curr); //得到当前页，以便向服务端请求对应页的数据。
									    console.log(obj.limit); //得到每页显示的条数
									   
									    //首次不执行
									    if(!first){
									      //do something
									      PStable(obj.curr,obj.limit);
									    }
									  }
								  });
							}
						});//数据渲染结束

					})
					
				}

            });     

            </script>

    </div>
</body>
</html>